var t = require("../../../@babel/runtime/helpers/defineProperty"),
  a = getApp();

Component({
  properties: {
    DataInfo: {
      type: null
    },
    store: {
      type: null
    },
    store_id: {
      type: null
    },
    goods_id: {
      type: Number
    },
    isType: {
      type: null
    }
  },
  data: {
    uploadUrl: "",
    store_id: "",
    sectionOptions: [],
    objectMultiArray: [],
    multiIndex: [0, 0, 0],
    regional: "请选择商品分类",
    objectMultiArray1: [{
      name: '按重'
    }, {
      name: '按件'
    }],
    regional1: "请选择运费模板",
    objectMultiArray2: [
      {
        name: '统一邮费'
      },
      {
        name: '运费模板'
      }
    ],
    regional2: "请选择运费配置",
    dispatch_type: '', //运费配置 0运费模板 1统一邮费
    dispatch_id: '', //运费模板id
    cargon_data: {
      title: "",
      sku: "个",
      thumb: "",
      price: "",
      market_price: "",
      cost_price: "0",
      stock: "",
      thumb_url: "",
      goods_sn: "",
      product_sn: "",
      // huanniu_ratio: 0, //牛证比率
      dispatch_price: '0', //邮费价格
      video: '', //视频路径
    },
    imageUrl: "",
    videoUrl: '', //视频图片
    fileList2: [],
    fileList1: [],
    detailImgList: [], //获取商品详情图片列表--编辑
    upNumMax: 0,
    upNumMaxOther: 0,
    fileList3: [],
    fileList4: [],
    selectedOptions3: [],
    jumpState: !0,
    shopText: "",
  },
  lifetimes: {
    attached: function () {},
    moved: function () {},
    detached: function () {},
    ready: function () {
      this.initData();
      console.log(this.properties.store), this.properties.store && this.setData({
        store: this.data.store
      }), this.properties.store_id && (this.setData({
        store_id: this.data.store_id
      }), this._getJson()), this.properties.goods_id && (this.setData({
        goods_id: this.properties.goods_id
      }), this._getJson(!0)), this._urlUp();
    }
  },
  attached: function () {},
  ready: function () {},
  pageLifetimes: {
    show: function () {},
    hide: function () {},
    resize: function () {}
  },
  methods: {
    commodityconfirm1: function (e) {
      console.log(e.detail.value, 'commodityconfirm')
      let index = e.detail.value
      this.setData({
        dispatch_id: this.data.objectMultiArray1[index].id,
        regional1: this.data.objectMultiArray1[index].name
      })
      console.log('commodityconfirm1', this.data.dispatch_id, this.data.regional1)
    },
    commodityconfirm2: function (e) {
      console.log(e.detail.value, 'commodityconfirm')
      let index = e.detail.value
      this.setData({
        dispatch_type: index,
        regional2: this.data.objectMultiArray2[index].name
      })
      console.log('commodityconfirm2', this.data.dispatch_type, this.data.regional2)
      // if (this.data.dispatch_type == 0) {
      //   this.setData({
      //     "cargon_data.dispatch_price": 0
      //   })
      // } else if (this.data.dispatch_type == 1) {
      //   this.setData({
      //     dispatch_id: ''
      //   })
      // }
      if (this.data.dispatch_type == 1) {
        this.setData({
          "cargon_data.dispatch_price": 0
        })
      } else if (this.data.dispatch_type == 0) {
        this.setData({
          dispatch_id: ''
        })
      }
    },
    initData: function () {
      var i = this,
        n = a.getNetAddresss("HuanNiu.list_ps_muban");
      a._getNetWork({
        url: n,
        data: {
          store_id: i.data.store_id,
        },
        success: function (a) {
          console.log(a, 'initdataaaa')
          if (1 == a.data.result) {
            let arr, arr1;
            arr = a.data.data
            arr1 = arr.map((item) => {
              return {
                id: item.list.id,
                name: item.list.dispatch_name
              }
            })
            console.log(arr1, 'arr111111111')
            i.setData({
              objectMultiArray1: arr1
            })
          }

        },
        fail: function (t) {
          console.log(t);
        }
      });
    },
    areaInp: function (t) {
      console.log(t);
      var a = t.detail.value;
      this.setData({
        shopText: a
      });
    },
    _urlUp: function () {
      ("store" == this.data.store || "supplier" == this.data.store) && this.setData({
        uploadUrl: "upload.uploadPic"
      });
    },
    _getJson: function () {
      var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0],
        e = this;
      if ("store" == e.data.store) {
        var i = a.getNetAddresss("plugin.store-cashier.frontend.store.goods-category.get-category-by-store-id");
        i += "&store_id=" + e.properties.store_id, a._getNetWork({
          url: i,
          success: function (a) {
            var i = a.data,
              s = [];
            if (console.log(i, "ssssssss"), i.data.length > 0 && i.data.list.map(function (t) {
                s.push({
                  name: t.name,
                  id: t.id,
                  childrens: t.childrens
                });
              }), e.setData({
                list: s
              }), 1 == i.result) {
              for (var d = [], n = 0; n < i.data.list.length; n++) {
                d.push({
                  id: i.data.list[n].id,
                  name: i.data.list[n].name,
                  children: []
                });
                for (var r = 0; r < i.data.list[n].childrens.length; r++) d[n].children.push({
                  id: i.data.list[n].childrens[r].id,
                  name: i.data.list[n].childrens[r].name
                });
              }
              e.setData({
                sectionOptions: d
              }), console.log(d), e.goodsHandlefunction(), t && e.getGoodsJson();
            } else wx.showToast({
              icon: "none",
              title: i.msg,
              duration: 1500
            });
          },
          fail: function (t) {
            console.log(t.msg);
          }
        });
      } else if ("supplier" == e.data.store) {
        var s = a.getNetAddresss("plugin.supplier.frontend.goods.get-category");
        a._postNetWork({
          url: s,
          showToastIn: !1,
          data: {},
          success: function (a) {
            var i = a.data,
              s = [];
            if (i.data.map(function (t) {
                s.push({
                  name: t.name,
                  id: t.id,
                  childrens: t.childrens
                });
              }), e.setData({
                list: s
              }), 1 == i.result) {
              for (var d = [], n = 0; n < i.data.length; n++)
                if (d.push({
                    id: i.data[n].id,
                    name: i.data[n].name,
                    children: []
                  }), !i.data[n].childrens || i.data[n].childrens.length < 1);
                else
                  for (var r = 0; r < i.data[n].childrens.length; r++)
                    if (d[n].children.push({
                        id: i.data[n].childrens[r].id,
                        name: i.data[n].childrens[r].name,
                        children: []
                      }), !i.data[n].childrens[r].childrens || i.data[n].childrens[r].childrens.length < 1);
                    else
                      for (var o = 0; o < i.data[n].childrens[r].childrens.length; o++) d[n].children[r].children.push({
                        id: i.data[n].childrens[r].childrens[o].id,
                        name: i.data[n].childrens[r].childrens[o].name
                      });
              e.setData({
                sectionOptions: d
              }), e.goodsHandlefunction(), t && e.getGoodsJson();
            } else wx.showToast({
              icon: "none",
              title: i.msg,
              duration: 1500
            });
          },
          fail: function (t) {}
        });
      }
    },
    commodityBtn: function (a) {
      var e = a.detail.column,
        i = a.detail.value,
        s = {
          multiArray: this.data.objectMultiArray
        };
      switch (this.setData(t({}, "multiIndex[" + e + "]", i)), e) {
        case 0:
          this.selecommodity_0(i);
          break;

        case 1:
          this.selecommodity_1(this.data.multiIndex[0], i);
      }
      this.setData(s);
    },
    goodsHandlefunction: function () {
      for (var t = this.data.sectionOptions, a = [], e = [], i = [], s = 0; s < t.length; s++) a.push({
        id: t[s].id,
        name: t[s].name
      });
      if (t[0].children.length > 0)
        for (var d = 0; d < t[0].children.length; d++) e.push({
          id: t[0].children[d].id,
          name: t[0].children[d].name
        });
      if (t[0].children && t[0].children.length > 0 && t[0].children[0].children && t[0].children[0].children.length > 0)
        for (var n = 0; n < t[0].children[0].children.length; n++) i.push({
          id: t[0].children[0].children[n].id,
          name: t[0].children[0].children[n].name
        });
      this.setData({
        "objectMultiArray[0]": a,
        "objectMultiArray[1]": e,
        "objectMultiArray[2]": i
      }), console.log(this.data.objectMultiArray);
    },
    selecommodity_0: function (t) {
      var a = this.data.sectionOptions,
        e = [],
        i = [];
      if (a[t].children.length > 0)
        for (var s = 0; s < a[t].children.length; s++) e.push({
          id: a[t].children[s].id,
          name: a[t].children[s].name
        });
      if (a[t].children && a[t].children.length > 0 && a[t].children[0].children && a[t].children[0].children.length > 0)
        for (var d = 0; d < a[t].children[0].children.length; d++) i.push({
          id: a[t].children[0].children[d].id,
          name: a[t].children[0].children[d].name
        });
      this.setData({
        "objectMultiArray[1]": e,
        "objectMultiArray[2]": i,
        "multiIndex[1]": 0,
        "multiIndex[2]": 0
      });
    },
    selecommodity_1: function (t, a) {
      var e = this.data.sectionOptions,
        i = [];
      if (e[t].children && e[t].children.length > 0 && e[t].children[a].children && e[t].children[a].children.length > 0)
        for (var s = 0; s < e[t].children[a].children.length; s++) i.push({
          id: e[t].children[a].children[s].id,
          name: e[t].children[a].children[s].name
        });
      this.setData({
        "objectMultiArray[2]": i,
        "multiIndex[2]": 0
      });
    },
    commodityconfirm: function (t) {
      var a = t.detail.value[0];
      if (this.data.list[a] && 0 == this.data.list[a].childrens.length) wx.showToast({
        title: "至少要选择二级分类",
        icon: "none",
        duration: 2e3
      });
      else {
        var e = this.data.sectionOptions,
          i = t.detail.value,
          s = i[0],
          d = i[1],
          n = i[2],
          r = [],
          o = [];
        e.length > 0 && (r.push(e[s].id), o.push(e[s].name), e[s].children.length > 0 && (r.push(e[s].children[d].id),
          o.push(e[s].children[d].name), e[s].children[d].children && e[s].children[d].children.length > 0 && (r.push(e[s].children[d].children[n].id),
            o.push(e[s].children[d].children[n].name)))), this.setData({
          regional: o.join("/"),
          selectedOptions3: r
        });
      }
    },
    onRead: function () {
      var t = this,
        e = a.getNetAddresss(this.data.uploadUrl);
      wx.chooseImage({
        count: 1,
        sizeType: ["original", "compressed"],
        sourceType: ["album", "camera"],
        success: function (a) {
          var i = a.tempFilePaths;
          wx.compressImage({
            src: i[0],
            quality: 60,
            success: function (a) {
              var i = a.tempFilePath;
              wx.uploadFile({
                url: e,
                filePath: i,
                name: "file",
                success: function (a) {
                  var e = JSON.parse(a.data);
                  1 == e.result ? t.setData({
                    imageUrl: i,
                    "cargon_data.thumb": e.data.img
                  }) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                  });
                }
              });
            },
            fail: function (t) {},
            complete: function (t) {}
          });
        }
      });
    },
    onVideo: function () {
      var t = this,
        e = a.getNetAddresss(this.data.uploadUrl);
      // e = 'https://shops.cg500.com/admin/shop?route=upload.uploadV3.upload&upload_type=video&tag_id='
      wx.chooseMedia({
        count: 1, //上传视频的个数
        mediaType: ['video'], //限制上传的类型为video
        sourceType: ['album', 'camera'], //视频选择来源
        camera: 'back', //采用后置摄像头  
        success: function (res) {
          // 返回选定照片的本地文件路径列表，tempFilePath可以作为img标签的src属性显示图片  
          // var tempFilePaths = res.tempFilePaths;

          let tempFilePath = res.tempFiles[0].tempFilePath
          console.log('tempFilePaths', res, tempFilePath)
          // let path = res.tempFiles[0].path
          wx.uploadFile({
            url: e,
            filePath: tempFilePath,
            name: "file",
            success: function (a) {

              // t.setData({
              //   videoUrl: res.tempFiles[0].path,
              // })
              var e = JSON.parse(a.data);
              console.log(e, 'aaaaaaaaaa')
              1 == e.result ? t.setData({
                videoUrl: e.data.img_url,
                "cargon_data.video": e.data.img
              }) : wx.showToast({
                icon: "none",
                title: e.msg,
                duration: 1500
              });
              console.log('videoUrl', t.data.videoUrl)
            }
          });

        }
      });
      // wx.chooseImage({
      //     count: 1,
      //     sizeType: [ "original", "compressed" ],
      //     sourceType: [ "album", "camera" ],
      //     success: function(a) {
      //         var i = a.tempFilePaths;
      //         wx.compressImage({
      //             src: i[0],
      //             quality: 60,
      //             success: function(a) {
      //                 var i = a.tempFilePath;
      //                 wx.uploadFile({
      //                     url: e,
      //                     filePath: i,
      //                     name: "file",
      //                     success: function(a) {
      //                         var e = JSON.parse(a.data);
      //                         1 == e.result ? t.setData({
      //                           videoUrl: i,
      //                             "cargon_data.thumb": e.data.img
      //                         }) : wx.showToast({
      //                             icon: "none",
      //                             title: e.msg,
      //                             duration: 1500
      //                         });
      //                     }
      //                 });
      //             },
      //             fail: function(t) {},
      //             complete: function(t) {}
      //         });
      //     }
      // });
    },
    onRead_1: function () {
      var t = this,
        e = a.getNetAddresss(this.data.uploadUrl);
      wx.chooseImage({
        count: 1,
        sizeType: ["original", "compressed"],
        sourceType: ["album", "camera"],
        success: function (a) {
          var i = a.tempFilePaths;
          wx.compressImage({
            src: i[0],
            quality: 60,
            success: function (a) {
              var i = a.tempFilePath;
              wx.uploadFile({
                url: e,
                filePath: i,
                name: "file",
                formData: {
                  attach: "upload"
                },
                success: function (a) {
                  var e = JSON.parse(a.data);
                  if (1 == e.result) {
                    var s = t.data.fileList1,
                      d = t.data.fileList2;
                    s.push({
                      url: e.data.img
                    }), d.push({
                      url: i
                    }), t.setData({
                      upNumMax: t.data.upNumMax + 1,
                      fileList1: s,
                      fileList2: d
                    });
                  } else wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                  });
                }
              });
            },
            fail: function (t) {},
            complete: function (t) {}
          });
        }
      });
    },
    removeImg: function (t) {
      var a = t.currentTarget.dataset.index,
        e = this.data.fileList1,
        i = this.data.fileList2,
        ii = this.data.detailImgList;
      e.splice(a, 1), i.splice(a, 1),ii.splice(a, 1), this.setData({
        fileList1: e,
        fileList2: i,
        detailImgList: ii
      }), this.setData({
        upNumMax: this.data.fileList1.length
      });
    },
    onRead_2: function () {
      var t = this,
        e = a.getNetAddresss(this.data.uploadUrl);
      wx.chooseImage({
        count: 1,
        sizeType: ["original", "compressed"],
        sourceType: ["album", "camera"],
        success: function (a) {
          var i = a.tempFilePaths;
          wx.compressImage({
            src: i[0],
            quality: 60,
            success: function (a) {
              var i = a.tempFilePath;
              wx.uploadFile({
                url: e,
                filePath: i,
                name: "file",
                formData: {
                  attach: "upload"
                },
                success: function (a) {
                  var e = JSON.parse(a.data);
                  if (1 == e.result) {
                    var s = t.data.fileList3,
                      d = t.data.fileList4;
                    s.push({
                      url: e.data.img_url
                    }), d.push({
                      url: i
                    }), t.setData({
                      upNumMaxOther: t.data.upNumMaxOther + 1,
                      fileList3: s,
                      fileList4: d
                    });
                  } else wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                  });
                }
              });
            },
            fail: function (t) {},
            complete: function (t) {}
          });
        }
      });
    },
    removeImg_1: function (t) {
      var a = t.currentTarget.dataset.index,
        e = this.data.fileList3,
        i = this.data.infoArr;
      e.splice(a, 1), this.setData({
        fileList3: e,
        infoArr: i
      }), this.setData({
        upNumMaxOther: this.data.fileList3.length
      });
    },
    titleinp: function (t) {
      var a = t.detail.value;
      this.setData({
        "cargon_data.title": a
      });
    },
    skuinp: function (t) {
      var a = t.detail.value;
      this.setData({
        "cargon_data.sku": a
      });
    },
    priceinp: function (t) {
      var a = t.detail.value;
      if (-1 !== a.indexOf(".")) {
        var e = a.indexOf("."),
          i = (a = a.replace(/[^\d]/g, "")).slice(0, e) + "." + a.slice(e);
        this.setData({
          "cargon_data.price": i
        });
      } else this.setData({
        "cargon_data.price": a
      });
    },
    marketpriceinp: function (t) {
      var a = t.detail.value;
      if (-1 !== a.indexOf(".")) {
        var e = a.indexOf("."),
          i = (a = a.replace(/[^\d]/g, "")).slice(0, e) + "." + a.slice(e);
        this.setData({
          "cargon_data.market_price": i
        });
      } else this.setData({
        "cargon_data.market_price": a
      });
    },
    costPriceinp: function (t) {
      var a = t.detail.value;
      if (-1 !== a.indexOf(".")) {
        var e = a.indexOf("."),
          i = (a = a.replace(/[^\d]/g, "")).slice(0, e) + "." + a.slice(e);
        this.setData({
          "cargon_data.cost_price": i
        });
      } else this.setData({
        "cargon_data.cost_price": a
      });
    },
    dispatchPriceinp: function (t) {
      var a = t.detail.value;
      if (-1 !== a.indexOf(".")) {
        var e = a.indexOf("."),
          i = (a = a.replace(/[^\d]/g, "")).slice(0, e) + "." + a.slice(e);
        this.setData({
          "cargon_data.dispatch_price": i
        });
      } else this.setData({
        "cargon_data.dispatch_price": a
      });
    },
    stockinp: function (t) {
      var a = t.detail.value;
      this.setData({
        "cargon_data.stock": a
      });
    },
    inpTap: function (a) {
      var e = a.currentTarget.dataset.key;
      this.setData(t({}, "cargon_data.".concat(e), a.detail.value));
    },
    setJson: function () {
      var t = [];
      if (0 != this.data.fileList1.length)
        for (var e = 0; e < this.data.fileList1.length; e++) t.push(this.data.fileList1[e].url);
      else t = [];
      var i = [];
      if (0 != this.data.fileList3.length)
        for (var s = 0; s < this.data.fileList3.length; s++) i.push(this.data.fileList3[s].url);
      else i = [];
      var d = {};
      if (!this.data.isType) {
        a._isTextEmpty(this.data.infoArr) && this.setData({
          infoArr: []
        }), console.log(this.data.infoArr, this.data.fileList3, "两个链接的数组");
        var n = this.data.infoArr.concat(this.data.fileList3);
        if (i = [], 0 != n.length)
          for (var r = 0; r < n.length; r++) "-1" == n[r].url.indexOf("wxfile") && i.push(n[r].url);
        else i = [];
      }
      console.log('hahahahaha', t, this.data.fileList2, this.data.fileList1, this.data.detailImgList)
      "store" == this.data.store ? (d = {
          store_id: this.data.store_id,
          category_pid: this.data.selectedOptions3[0],
          category_cid: this.data.selectedOptions3[1],
          title: this.data.cargon_data.title,
          thumb: this.data.cargon_data.thumb,
          thumb_url: i,
          good_content: t,
          cost_price: this.data.cargon_data.cost_price,
          market_price: this.data.cargon_data.market_price,
          price: this.data.cargon_data.price,
          sku: this.data.cargon_data.sku,
          stock: this.data.cargon_data.stock,
          goods_sn: this.data.cargon_data.goods_sn,
          product_sn: this.data.cargon_data.product_sn,
          // huanniu_ratio: this.data.cargon_data.huanniu_ratio,
          dispatch_price: this.data.cargon_data.dispatch_price,
          dispatch_type: this.data.dispatch_type == 0 ? 1 : 0,
          dispatch_id: this.data.dispatch_id,
          video: this.data.cargon_data.video,
          content_text: this.data.shopText
        }, this.data.isType || (d = {
          store_id: this.data.store_id,
          goods_id: this.data.goods_id,
          category_pid: this.data.selectedOptions3[0],
          category_cid: this.data.selectedOptions3[1],
          title: this.data.cargon_data.title,
          thumb: this.data.cargon_data.thumb,
          thumb_url: i,
          good_content: this.data.detailImgList.concat(t),
          cost_price: this.data.cargon_data.cost_price,
          market_price: this.data.cargon_data.market_price,
          price: this.data.cargon_data.price,
          sku: this.data.cargon_data.sku,
          stock: this.data.cargon_data.stock,
          goods_sn: this.data.cargon_data.goods_sn,
          product_sn: this.data.cargon_data.product_sn,
          // huanniu_ratio: this.data.cargon_data.huanniu_ratio,
          dispatch_price: this.data.cargon_data.dispatch_price,
          dispatch_type: this.data.dispatch_type == 1 ? 0 : 1,
          dispatch_id: this.data.dispatch_id,
          video: this.data.cargon_data.video,
          content_text: this.data.shopText
        })) : "supplier" == this.data.store && (d = {
          title: this.data.cargon_data.title,
          thumb: this.data.cargon_data.thumb,
          thumb_url: i,
          good_content: t,
          cost_price: this.data.cargon_data.cost_price,
          market_price: this.data.cargon_data.market_price,
          price: this.data.cargon_data.price,
          sku: this.data.cargon_data.sku,
          stock: this.data.cargon_data.stock,
          content_text: this.data.shopText
        }, this.data.isType || (d = {
          title: this.data.cargon_data.title,
          thumb: this.data.cargon_data.thumb,
          thumb_url: i,
          cost_price: this.data.cargon_data.cost_price,
          market_price: this.data.cargon_data.market_price,
          price: this.data.cargon_data.price,
          sku: this.data.cargon_data.sku,
          stock: this.data.cargon_data.stock
        }), this.data.selectedOptions3.length < 3 ? (d.category_pid = this.data.selectedOptions3[0],
          d.category_cid = this.data.selectedOptions3[1]) : (d.category_pid = this.data.selectedOptions3[0],
          d.category_cid = this.data.selectedOptions3[1], d.category_tid = this.data.selectedOptions3[2])),
        this.triggerEvent("getChildoneData", d, {
          bubbles: !1
        });
    },
    jumpEvent: function () {
      for (var t in this.setData({
          jumpState: !0
        }), this.data.cargon_data) "" == this.data.cargon_data[t] && this.setData({
        jumpState: !1
      });
      0 == this.data.selectedOptions3.length && this.setData({
        jumpState: !1
      }), "" == this.data.imageUrl && this.setData({
        jumpState: !1
      });
    },
    getGoodsJson: function () {
      var t = this,
        e = "",
        i = {};
      "store" == t.data.store ? (e = a.getNetAddresss("plugin.store-cashier.frontend.store.goods.get-goods-detail"),
        i = {
          goods_id: t.data.goods_id
        }) : "supplier" == t.data.store && (e = a.getNetAddresss("plugin.supplier.frontend.goods.goods-detail"),
        i = {
          goods_id: t.data.goods_id
        }), a._postNetWork({
        url: e,
        showToastIn: !1,
        data: i,
        success: function (a) {
          var e = a.data;
          console.log('bassssssss', JSON.parse(e.data.huanniu_content))

          if (1 == e.result) {
           
            if(e.data.huanniu_content) {
              let contentArr = JSON.parse(e.data.huanniu_content)
              let arr = []
              let arr1 = []
              contentArr.forEach((item) => {
                let str = 'https://shops.cg500.com/static/upload/' + item
                arr.push({
                  url: str
                })
                arr1.push(item)
              })
              console.log('arrhhhhhhh', arr, arr1)
              t.setData({
                fileList2: arr,
                detailImgList: arr1
              })
            }
            
            var i = t.data.selectedOptions3;
            if (e.data.category_ids.parentid && i.push(Number(e.data.category_ids.parentid)),
              e.data.category_ids.childid && i.push(Number(e.data.category_ids.childid)), e.data.category_ids.thirdid && i.push(Number(e.data.category_ids.thirdid)),
              t.setData({
                selectedOptions3: i
              }), null != e.data.thumb_url && "" != e.data.thumb_url) {
              for (var s = t.data.fileList3, d = 0; d < e.data.thumb_url.length; d++) s.push({
                url: e.data.thumb_url[d]
              });
              console.log(t.data), console.log(s), t.setData({
                fileList3: s,
                infoArr: [],
                upNumMax: e.data.thumb_url.length
              });
            }
            console.log(e.data, 'hhhhhhh')
            t.setData({
              "cargon_data.title": e.data.title,
              "cargon_data.sku": e.data.sku,
              imageUrl: e.data.thumb,
              "cargon_data.thumb": e.data.thumb,
              "cargon_data.price": e.data.price,
              "cargon_data.market_price": e.data.market_price,
              "cargon_data.cost_price": e.data.cost_price,
              "cargon_data.stock": e.data.stock,
              "cargon_data.thumb_url": e.data.thumb_url,
              "cargon_data.goods_sn": e.data.goods_sn,
              "cargon_data.product_sn": e.data.product_sn,
              // "cargon_data.huanniu_ratio": e.data.huanniu_ratio,
              "cargon_data.dispatch_price": e.data.dispatch ? e.data.dispatch.dispatch_price : '0',
              "cargon_data.video": e.data.video ? e.data.video.goods_video : '',
              // fileList2: e.data.video ? e.data.video.goods_video : '',//商品详情
              videoUrl: e.data.video ? 'https://shops.cg500.com/static/upload/' + e.data.video.goods_video : '',
              dispatch_type: e.data.dispatch ? e.data.dispatch.dispatch_type == 0 ? 1 : 0 : '',
              dispatch_id: e.data.dispatch ? e.data.dispatch.dispatch_id : '',
              regional1: e.data.dispatch ? e.data.dispatch.dispatch_name : '请选择运费模板',
              regional2: e.data.dispatch ? (e.data.dispatch.dispatch_type == 0 ? '运费模板' : '统一邮费') : '请选择运费配置',
              shopText: e.data.huanniu_description
            }), t.commodityInit();
          } else wx.showToast({
            icon: "none",
            title: e.msg,
            duration: 1500
          });
        },
        fail: function (t) {}
      });
    },
    commodityInit: function () {
      for (var t = this.data.selectedOptions3, a = this.data.sectionOptions, e = [], i = [], s = "", d = 0; d < a.length; d++)
        if (a[d].id == t[0]) {
          this.setData({
            "multiIndex[0]": d
          }), s += a[d].name;
          break;
        }
      if (console.log(this.data.multiIndex, "分类的数组"), console.log(a, "选中的项"), a[this.data.multiIndex[0]].children.length > 0)
        for (var n = 0; n < a[this.data.multiIndex[0]].children.length; n++) e.push({
          id: a[this.data.multiIndex[0]].children[n].id,
          name: a[this.data.multiIndex[0]].children[n].name
        });
      if (this.setData({
          "objectMultiArray[1]": e
        }), a[this.data.multiIndex[0]].children.length > 0)
        for (var r = 0; r < a[this.data.multiIndex[0]].children.length; r++)
          if (a[this.data.multiIndex[0]].children[r].id == t[1]) {
            this.setData({
              "multiIndex[1]": r
            }), s += "/" + a[this.data.multiIndex[0]].children[r].name;
            break;
          }
      if (a[this.data.multiIndex[0]].children && a[this.data.multiIndex[0]].children.length > 0 && a[this.data.multiIndex[0]].children[this.data.multiIndex[1]].children && a[this.data.multiIndex[0]].children[this.data.multiIndex[1]].children.length > 0)
        for (var o = 0; o < a[this.data.multiIndex[0]].children[this.data.multiIndex[1]].children.length; o++) i.push({
          id: a[this.data.multiIndex[0]].children[this.data.multiIndex[1]].children[o].id,
          name: a[this.data.multiIndex[0]].children[this.data.multiIndex[1]].children[o].name
        });
      if (this.setData({
          "objectMultiArray[2]": i
        }), a[this.data.multiIndex[0]].children && a[this.data.multiIndex[0]].children.length > 0 && a[this.data.multiIndex[0]].children[this.data.multiIndex[1]].children && a[this.data.multiIndex[0]].children[this.data.multiIndex[1]].children.length > 0)
        for (var l = 0; l < a[this.data.multiIndex[0]].children[this.data.multiIndex[1]].children.length; l++)
          if (a[this.data.multiIndex[0]].children[this.data.multiIndex[1]].children[l].id == t[2]) {
            this.setData({
              "multiIndex[2]": l
            }), s += "/" + a[this.data.multiIndex[0]].children[this.data.multiIndex[1]].children[l].name;
            break;
          }
      this.setData({
        regional: s
      });
    }
  }
});